package com.SFA.Dictionary;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import com.FrameWork.Common.MyApplication;
import com.FrameWork.Entity.DictionaryItemEntity;
import com.FrameWork.Entity.GlobalInfo;

import android.content.Context;
import android.util.Log;

public class DictionaryManager {

	public static final String CustomrType = "Customer_Type".toLowerCase();
	public static final String Channel = "Channel".toLowerCase();
	public List<DictionaryItemEntity> LoadDictionaryList(Context context,String type)
	{
		
		
		 List<DictionaryItemEntity> list = new ArrayList<DictionaryItemEntity>();
		 android.database.sqlite.SQLiteCursor reader = null;
		 try
		 {
			 reader =MyApplication.getInstance().DataProvider .getCursor("DICTIONARY", new String[]{"DICTIONARYITEMID","NAME","CODE"}, "ACTIVE='True' and lower(DICTIONARYCODE)='" + type +"'", null, null, null, null);
			
			 while(reader.moveToNext())
			 {
				 DictionaryItemEntity entity = new DictionaryItemEntity();
				 entity.DictionaryItemID = reader.getString(0);
				 entity.Name =reader.getString(1);
				 entity.Code =reader.getString(2);
				 list.add(entity);
			 }
		 }
		 catch(Exception err)
		 {
			 	Log.w("LoadDictionaryList", err.getMessage());
		 }
		 finally
		 {
			 if (reader != null)
				{
					reader.close();
					reader = null;
				}
		 }
		return list;
	}
}
